// load pins
int buzzerPin = 2;
int firstLedPin = 8;
int secondLedPin = 12;

// init pins
void setup() {
  pinMode(buzzerPin, OUTPUT);
  Serial.begin(9600);
  pinMode(firstLedPin, OUTPUT);
  pinMode(secondLedPin, OUTPUT);
  digitalWrite(firstLedPin, LOW);
  digitalWrite(secondLedPin, LOW);
}

// loop function
void loop() {
  while (Serial.available()) {
    char c = Serial.read();
    // first led
    if (c == 'l' || c == 'L') {
      digitalWrite(firstLedPin, HIGH);
      Serial.println("Led is on.");
    }
    // second led
    if (c == 'r' || c == 'R') {
      digitalWrite(secondLedPin, HIGH);
      Serial.println("Led is on.");
    }
    // buzzer
    if (c == 'b' || c == 'B') {
      digitalWrite(buzzerPin, HIGH);
      tone(buzzerPin, 100000, 0.01);
      Serial.println("Buzzer is on.");
    }
    // stop
    if (c == 's' || c == 'S') {
      digitalWrite(firstLedPin, LOW);
      digitalWrite(secondLedPin, LOW);
      noTone(buzzerPin);
    }
  }
}
